The Elder Scrolls Forums

TES Construction Set and Plugins >> General TES Construction Set

Pages: 1 | 2 | (show all)
Bloody_Me
Novice

Reged: 08/09/04
Posts: 18
Loc: Croatia
Script questions
      #2939697 - 08/17/04 11:12 AM

I made a new topic with a script but now everyone has it and I want only one NPC to have it.
Can I change value of a variable in a script from a dialogue with a nother NPC? What I want to do actualy is this: I have an activator wich teleports you. I want to allowe using this activator only if you pay gold to one NPC (in a dialogue).

Post Extras: Print Post   Remind Me!   Notify Moderator  
Archived User Account

Re: Script questions [Re: Bloody_Me]
      #2940178 - 08/17/04 02:06 PM

I didn't understand all you said, but generally here's how you do it:

1-Make a global variable. Call it something like BM_allowtele_01
2-Make a new dialog topic and make the "ID" of the NPC in the functions part the one you need.
3-Add the "Set BM_allowtele_01 to 1" line in the result tab.
4-Attach this script to check for the global to the activator.
5-Make sure to introduce the topic.

Post Extras: Print Post   Remind Me!   Notify Moderator  
Bloody_Me
Novice

Reged: 08/09/04
Posts: 18
Loc: Croatia
Re: Script questions [Re: ]
      #2940793 - 08/17/04 04:40 PM

I didn't quite understand all you said eather, but it doesent matter, I figured what was wrong anyway.
-for the first part where I made a new topic and it appeared at all NPC's, all I had to do was put an ID of a NPC (for whom I wished to be the only one knowing the topic) in the "Speaker Condition" for that topic
-and the second part: I tryed to enter this formula: "Set MyObject.variable to 1" at a certen point in conversation, so it would change a variable in a script on a nother object. But it didn't work.
Later I relised that I only need to change the ID of an object in formula, becouse my old object's ID started with: (bm), so TESCS recognised it as a variable without a function
Preety stupid actualy

Post Extras: Print Post   Remind Me!   Notify Moderator  
TheSlof
Curate

Reged: 03/16/04
Posts: 425
Loc: Trollhättan, Sweden
Re: Script questions [Re: Bloody_Me]
      #2940840 - 08/17/04 05:00 PM

In the dialogue.. Change the settings for your topic to allow ONLY your NPC to say it.

--------------------
My tutorials:
Here or here!
||||||

Post Extras: Print Post   Remind Me!   Notify Moderator  
Bloody_Me
Novice

Reged: 08/09/04
Posts: 18
Loc: Croatia
Re: Script questions [Re: Bloody_Me]
      #2947537 - 08/19/04 02:31 PM

Well now I need more help with scripting:
1. I want a creature to disapear when PC exits a cell. But for some reason "CellChanged" (like at slaves scripts) or "GetPCCell" doesen't work. I tried with "disable" and "SetDelete, 1" in every posible combination.
2. I made an object wich when activated asks you a question. Depending on wich button you press, a creature is created at a certain location. The problem is that after you first answer a question, apropriate creature is created everytime you press it's belonging button (if you try to recharge a item, or use Hircine's ring forinstance...) while in cell where's this local script is running. I tryed with "if ( menumode == 1 ) return" and with "StopScript" but it doesent work
help please!

Post Extras: Print Post   Remind Me!   Notify Moderator  
Mode_Locrian
Diviner

Reged: 10/07/02
Posts: 2084
Loc: Bjornholm, Rykith Lowlands Region
Re: Script questions [Re: Bloody_Me]
      #2947712 - 08/19/04 03:23 PM

It would be much easier to help you with this if you posted your scripts so we could try to debug them... otherwise we just have to try to guess what's wrong.

--------------------
My Website
Bards of Vvardenfell Thread (New Info 8/15/04)


Post Extras: Print Post   Remind Me!   Notify Moderator  
TheSlof
Curate

Reged: 03/16/04
Posts: 425
Loc: Trollhättan, Sweden
Re: Script questions [Re: Mode_Locrian]
      #2947786 - 08/19/04 03:41 PM

Id you Disable something by the script attached to that something, Morrowing will go mad... Eh.. Create a new script:

Code:
 
begin _delete_creatureid

creature_id->disable
stopscript

end



and call it by adding startscript, _delete_creatureid to your script.

This MAY disable ALL creatures of this type.. I'm not quite sure... Try it!

--------------------
My tutorials:
Here or here!
||||||

Post Extras: Print Post   Remind Me!   Notify Moderator  
Mode_Locrian
Diviner

Reged: 10/07/02
Posts: 2084
Loc: Bjornholm, Rykith Lowlands Region
Re: Script questions [Re: TheSlof]
      #2947873 - 08/19/04 04:02 PM

MW doesn't have a problem with an object disabling itself. Have a look at the stronghold building scripts, for instance. I've had objects call disable and setdelete on the themselves without any problems.

--------------------
My Website
Bards of Vvardenfell Thread (New Info 8/15/04)


Post Extras: Print Post   Remind Me!   Notify Moderator  
Bloody_Me
Novice

Reged: 08/09/04
Posts: 18
Loc: Croatia
Re: Script questions [Re: Mode_Locrian]
      #2948577 - 08/19/04 07:30 PM

It's a simple local script. I hade it attached to a creature. I tryed this:
-------------------------
if ( player->CellChanged == 1 )
disable
endif

or

if ( CellChanged == 1 )
disable
endif

or

if ( GetPCCell "Balmora" == 0 )
disable
endif
-------------------------------------------
I also tryed that on global scripts:
-------------------------------------------
if ( GetPCCell "Balmora" == 0 )
disable -> creature_id (or: creature_id -> disable )
endif

and

if ( CellChanged == 1 )
disable -> creature_id (or: creature_id -> disable )
StopScript "script_id"
endif
--------------------------------------------------------------------------
i also copied entire script I found on scripting for dummies:
--------------------------------------------------------------------------
if ( player->CellChanged == 1 )
Disable
set timer_flag to 1
endif

if ( timer_flag == 1 )
set timer to ( timer + GetSecondsPassed )
if ( timer > 1.5 )
set obj_count to ( obj_count - 1 )
SetDelete, 1
else
return ; stop all other code processing
endif
endif
--------------------------------------
I thought that it had something to do with the fact that there are no creatures in the game with same ID untill PC creates it in the game using an activator (has this script on selfe:

Short variable
Short button

if ( OnActivate == 1 )
MessageBox "question", "option1", "option2", "option3"
set variable to 1
endif

if ( variable == 1 )
set button to GetButtonPressed
if ( button == -1 )
return

elseif ( button == 0 )
PlaceItem "creature_id1" x y z zrot

elseif ( button == 1 )
PlaceItem "creature_id2" x y z zrot

elseif ( button == 2 )
MessageBox "text"
endif
endif

so I put creature in the cell where there were suposed to be created but it also didn't matter
------------------------------
I tried creating them with global and local scripts, disableing them with globals and locals, I tried every posible combination but nothing seems to work
----------------------------
but this script attached to a creature for some reason works:
if ( OnDeath == 1 )
disable
endif

and it works with or without same ID creatures in game, runned from local script or targeted global script

Post Extras: Print Post   Remind Me!   Notify Moderator  
Mode_Locrian
Diviner

Reged: 10/07/02
Posts: 2084
Loc: Bjornholm, Rykith Lowlands Region
Re: Script questions [Re: Bloody_Me]
      #2948591 - 08/19/04 07:37 PM

if ( CellChanged == 1 ) is the proper syntax... no need to call it on the player.

CellChanged is a little bit finicky in outdoor cells, in my experience. If the creature is outside, maybe make a distance check instead?

e.g.

if ( GetDistance, Player > 5000 )
disable
endif

This wil disable the creature once the player is suitably far away.

For the placeItem call you're using, you realize that you have to use actual numberical values where you have x, y, and z, right?

--------------------
My Website
Bards of Vvardenfell Thread (New Info 8/15/04)


Post Extras: Print Post   Remind Me!   Notify Moderator  
Bloody_Me
Novice

Reged: 08/09/04
Posts: 18
Loc: Croatia
Re: Script questions [Re: Mode_Locrian]
      #2948794 - 08/19/04 08:46 PM

It's an Indoor cell, and creature attacks on sight so I'll hardly get far enough
I know. I didn't feal like writing the exact values

TheSlof- I tried that too and it didn't work. I also tryed with two global scripts: when I activate an activator it starts a global script:
BEGIN monitor
if ( GetPCCell "cell_id" == 0 )
StartScript "del"
StopScript "monitor"
END
-------------------------
BEGIN del
creature_id->disable
StopScript "del"
END

But nothing seems to work. Twice when I didn't put StopScript "monitor" the game froze, only music keept playng.
Maybe it has something to do with the fact that I cant enter this cell by door but only by script (player->positioncell), and exit it by teleport magic or script (player->positioncell)

Post Extras: Print Post   Remind Me!   Notify Moderator  
cyran0
Initiate

Reged: 06/04/04
Posts: 58
Re: Script questions [Re: Bloody_Me]
      #2949006 - 08/19/04 09:48 PM

Quote:

Maybe it has something to do with the fact that I cant enter this cell by door but only by script (player->positioncell), and exit it by teleport magic or script (player->positioncell)



I’m just spit-balling here, but it may have something to do with your teleporting (using PositionCell) out of the interior cell rather than using a door activator. I’ve wondered how CellChanged actually works; as soon as the player leaves the cell where the local script is running, the script should cease to execute. So how can it test to see if the player has left the cell? Obviously it does work, such as in the case of disabling freed slaves, so CellChange may actually check to see if a teleport activator (door) has been activated. The activator is the trigger for the disabling (or whatever is to follow). Someone else may be able to confirm this… or that I don’t know what I am talking about.

If the former is the case, you either need, a more conventional way to leave the cell, or devise a way to detect when the player is leaving by some other means (recall, intervention, etc.).

[Actually, I just tested my theory and it failed. I freed some slaves and left via the console with coc and PositionCell. They’re gone, and left no forwarding address. That’s alright, I am accustom to the educational benefits of failure—at least you’ve eliminated one more possibility.]

Post Extras: Print Post   Remind Me!   Notify Moderator  
Mode_Locrian
Diviner

Reged: 10/07/02
Posts: 2084
Loc: Bjornholm, Rykith Lowlands Region
Re: Script questions [Re: cyran0]
      #2949118 - 08/19/04 10:13 PM

Ok, try this... since cellChanged only returns true for 1 frame, maybe it returns true before the cell is fully loaded, so the script doesn't have time to disable. It's an outside shot, but it's worth a try.

short setDisable

if ( cellChanged == 1 )
set setDisable to 1
endif

if ( setDisable == 1 )
disable
endif


--------------------
My Website
Bards of Vvardenfell Thread (New Info 8/15/04)


Post Extras: Print Post   Remind Me!   Notify Moderator  
TheSlof
Curate

Reged: 03/16/04
Posts: 425
Loc: Trollhättan, Sweden
Re: Script questions [Re: Mode_Locrian]
      #2950323 - 08/20/04 08:20 AM

Quote:

MW doesn't have a problem with an object disabling itself



Ooops.. It's RemoveItem that crashes... Sorry!!
And I tried scrib->disable in-game, but nothing happened, so...
I'm just going to let you guys figure it out on your own..

--------------------
My tutorials:
Here or here!
||||||

Post Extras: Print Post   Remind Me!   Notify Moderator  
Bloody_Me
Novice

Reged: 08/09/04
Posts: 18
Loc: Croatia
Re: Script questions [Re: Mode_Locrian]
      #2955457 - 08/21/04 06:56 PM

tryed it, and tryed it. I also tryed something like from a spymasters script when he leaves from morrowind, and from some nord burial script but apsolutly nothing worked. Than I tryed disableing the creature after one game hour sence it was created but that too didn't work.
ok, I might have gotten the "time" script wrong so I'll try a cuple of times more

Post Extras: Print Post   Remind Me!   Notify Moderator  
TheSlof
Curate

Reged: 03/16/04
Posts: 425
Loc: Trollhättan, Sweden
Re: Script questions [Re: Bloody_Me]
      #2958246 - 08/22/04 02:20 PM

Can't you use GetDistance? Too far away, and the creature is disabled (you may want to use the GetDistance thingy on the activator and set a global to 1, have a script on the creatures disable them, and then (after a second?) set the global to 0 again).

--------------------
My tutorials:
Here or here!
||||||

Post Extras: Print Post   Remind Me!   Notify Moderator  
Bloody_Me
Novice

Reged: 08/09/04
Posts: 18
Loc: Croatia
Re: Script questions [Re: TheSlof]
      #2962319 - 08/23/04 04:53 PM

It's an interior cell and creatures attack on sight so you'll hardly get far enough. But it doesent matter now anyway, I have released this mod: Battle Arena of Giants and you can look for it in mod sections
And if you want creatures to disapier, you'll just have to kill them, heheh

Post Extras: Print Post   Remind Me!   Notify Moderator  
TheSlof
Curate

Reged: 03/16/04
Posts: 425
Loc: Trollhättan, Sweden
Re: Script questions [Re: Bloody_Me]
      #2965294 - 08/24/04 12:43 PM

Good one!
And I presume this took a lot of hard coding..?
Maybe I'll have a look at it..

--------------------
My tutorials:
Here or here!
||||||

Post Extras: Print Post   Remind Me!   Notify Moderator  
Simpleton
Acolyte

Reged: 07/02/04
Posts: 138
Loc: Earlham College, Richmond, IN
Re: Script questions [Re: Mode_Locrian]
      #2966620 - 08/24/04 07:28 PM

CellChanged is set upon entering a cell through a door. Local scripts in the previous cell that check CellChanged will not be affected. The reason the CellChanged attempts didn't work is because you are teleporting the PC, and teleporting doesn't trigger CellChanged. The reason your monsters kept spawning when you selected buttons on other dialogs is because after you created the monster you didn't set "variable" back to 0, so it was checking GetButtonPressed every frame, even after you spawned the monster.

GetPCCell should work fine, but it does require more work than CellChanged.

A good solution would be to use a global script to make your own personal CellChanged using GetPCCell:
Code:

short flag

if ( EnteringArena == 1 )
set EnteringArena to 0
endif

if ( GetPCCell, "<cell name>" == 1)
if ( flag == 0 )
set flag to 1
set EnteringArena to 1
endif
else
if ( flag == 1 )
set flag to 0
endif
endif



With this script running you should be able to use EnteringArena like CellChanged except that it will work with teleportation and will only trigger when entering this specific cell.

EDIT: oh ya, and remember to create EnteringArena as a global short

hmm.. maybe I should test this before I start pretending I know what I'm talking about... brb

--------------------
Do you have a burning desire to give me money?
Click Here to Donate

Edited by Simpleton (08/24/04 07:50 PM)

Post Extras: Print Post   Remind Me!   Notify Moderator  
Simpleton
Acolyte

Reged: 07/02/04
Posts: 138
Loc: Earlham College, Richmond, IN
Re: Script questions [Re: Simpleton]
      #2966823 - 08/24/04 08:35 PM

Here are some edited version of your scripts with the changes I mentioned above. I have not yet tested if my fix for the bug with the buttons works, but I think it will. The other changes have been tested and work fine.

oh, and I fixed one typo I noticed, there are some others but I think they improve immersion, since back then people spelled things differently all the time.
Code:
BEGIN Panel


short flag
short button

if ( ScriptRunning, "EnterArenaScript" == 0 )
StartScript, "EnterArenaScript"
endif

if ( flag == 1 )
set button to GetButtonPressed
if ( button == -1 )
return
elseif ( button == 0 )
PlaceItem "blm_almalexia", 4206 6582 11762 150
MessageBox "Almalexia awaits!"
elseif ( button == 1 )
PlaceItem "blm_bloody_me", 4206 6582 11762 150
MessageBox "Bloody_Me awaits!"
elseif ( button == 2 )
PlaceItem "blm_dagoth_ur" 4206 6582 11762 150
MessageBox "Dagoth Ur awaits!"
elseif ( button == 3 )
PlaceItem "blm_gaenor" 4206 6582 11762 150
MessageBox "Gaenor awaits!"
elseif ( button == 4 )
PlaceItem "blm_hircine" 4206 6582 11762 150
MessageBox "Hircine awaits!"
elseif ( button == 5 )
PlaceItem "blm_imperfect" 4206 6582 11762 150
MessageBox "Imperfect awaits!"
elseif ( button == 6 )
PlaceItem "blm_the_udyrfrykte" 4206 6582 11762 150
MessageBox "The Udyrfrykte awaits!"
elseif ( button == 7 )
PlaceItem "blm_vivec" 4206 6582 11762 150
MessageBox "Vivec awaits!"
elseif ( button == 8 )
MessageBox "Coward!"
endif
set flag to 0
return
endif

if ( OnActivate == 0 )
return
endif

MessageBox "Who do you wish to fight against?", "Almalexia", "Bloody_Me", "Dagoth Ur", "Gaenor", "Hircine", "Imperfect", "The Udyrfrykte", "Vivec", "No one. I'm scared."
set flag to 1

END Panel



Code:
begin EnterArenaScript

short flag

if ( EnteringArena == 1 )
set EnteringArena to 0
endif

if ( GetPCCell, "Battle Arena of Giants" == 1)
if ( flag == 0 )
set flag to 1
set EnteringArena to 1
endif
else
if ( flag == 1 )
set flag to 0
endif
endif

end


Code:

BEGIN DisOpp
short counter

if ( counter > 0 )
if ( counter == 1 )
SetDelete, 1
endif
set counter to counter - 1
return
endif

if ( OnDeath == 1 )
disable
PlaySound "conjuration hit"
set counter to 11
endif

if ( EnteringArena == 1 )
disable
set counter to 11
endif

END DisOpp



create a new script for the EnterArenaScript, also make sure to create the EnteringArena global variable.

Hope this works out for ya.

very good job on the mod btw.
if you ever plan on expanding it or something and need help with scripting just ask!

--------------------
Do you have a burning desire to give me money?
Click Here to Donate

Post Extras: Print Post   Remind Me!   Notify Moderator  
TheSlof
Curate

Reged: 03/16/04
Posts: 425
Loc: Trollhättan, Sweden
Re: Script questions [Re: Simpleton]
      #2969301 - 08/25/04 02:52 PM

Quote:

MessageBox "Who do you wish to fight against?", "Almalexia", "Bloody_Me", "Dagoth Ur", "Gaenor", "Hircine", "Imperfect", "The Udyrfrykte", "Vivec", "No one. I'm scared."
set flag to 1




Doesn't this messagebox appear over and over again, even if you select "No one. I'm scared."?

--------------------
My tutorials:
Here or here!
||||||

Post Extras: Print Post   Remind Me!   Notify Moderator  
Simpleton
Acolyte

Reged: 07/02/04
Posts: 138
Loc: Earlham College, Richmond, IN
Re: Script questions [Re: TheSlof]
      #2969436 - 08/25/04 03:39 PM

no, the script will only get to that point for the single frame when the panel is activated.

note the code right above it:
Code:

if ( OnActivate == 0 )

return

endif


this works exactly the same way as:
Code:
 
if ( OnActivate == 1 )
MessageBox "Who do you wish to fight against?", "Almalexia", "Bloody_Me", "Dagoth Ur", "Gaenor", "Hircine", "Imperfect", "The Udyrfrykte", "Vivec", "No one. I'm scared."
set flag to 1
endif


many people consider this last example to be easier to read and understand, but I prefer the first because that type of coding helps avoid overly complex nested if statements, and in rare circumstances will speed up the script.

--------------------
Do you have a burning desire to give me money?
Click Here to Donate

Post Extras: Print Post   Remind Me!   Notify Moderator  
Pages: 1 | 2 | (show all)


Extra information
0 registered and 4 anonymous users are browsing this forum.

Moderator:  Umrahel, Freddo, Pete, Hungry Donner, Attrebus, Miltiades, tegger 

Print Thread

Permissions
      You cannot start new topics
      You cannot reply to topics
      HTML is disabled
      UBBCode is enabled

Rating:
Thread views: 291

Rate this thread
 
Jump to

The Elder Scrolls Homepage

*
UBB.threads™ 6.3

Click for Privacy Statement © 2003 Bethesda Softworks LLC, a ZeniMax Media company. All Rights Reserved.
PRIVACY POLICY | TERMS & CONDITIONS | LEGAL INFORMATION | CONTACT US